<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../assets/lib/layui/css/layui.css">
    <link rel="stylesheet" href="../assets/lib/cropper/cropper.css">
    <style>
        /* .cropper-box {
            width: 350px;
            height: 350px;
            text-align: center;
            line-height: 350px;
            color: #ddd;
            font-size: 24px;
        }

        .cropper-box img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        input {
            width: 92px;
            opacity: 0;
        }

        img {
            width: 100%;
            height: 100%;
        } */

        .layui-btn {
            position: relative;
            text-align: center;
        }

        .layui-btn p {
            position: absolute;
            top: 0;
            left: 36px;
        }

        /* 设置卡片主体区域的宽度 */
        .layui-card-body {
            width: 500px;
        }

        /* 设置按钮行的样式 */
        .row2 {
            display: flex;
            justify-content: flex-start;
            margin-top: 20px;
        }

        /* 设置裁剪区域的样式 */
        .cropper-box {
            width: 350px;
            height: 350px;
            background-color: cyan;
            overflow: hidden;
        }

        /* 设置第一个预览区域的样式 */
        .w100 {
            width: 100px;
            height: 100px;
            background-color: gray;
        }

        /* 设置第二个预览区域的样式 */
        .w50 {
            width: 50px;
            height: 50px;
            background-color: gray;
            margin-top: 50px;
        }

        /* 设置预览区域下方文本的样式 */
        .size {
            font-size: 12px;
            color: gray;
            text-align: center;
        }

        /* 设置图片行的样式 */
        .row1 {
            display: flex;
        }

        /* 设置 preview-box 区域的的样式 */
        .preview-box {
            display: flex;
            flex-direction: column;
            flex: 1;
            align-items: center;
        }

        /* 设置 img-preview 区域的样式 */
        .img-preview {
            overflow: hidden;
            border-radius: 50%;
        }

        #file {
            display: none;
        }
    </style>
</head>

<body>
    <div class="layui-card">
        <div class="layui-card-header">更换头像</div>
        <div class="layui-card-body">
            <div class="row1">
                <div class="cropper-box">
                    <img id="image" src="../assets/images/sample.jpg" />
                </div>
                <!-- 图片的预览区域 -->
                <div class="preview-box">
                    <div>
                        <!-- 宽高为 100px 的预览区域 -->
                        <div class="img-preview w100"></div>
                        <p class="size">100 x 100</p>
                    </div>
                    <div>
                        <!-- 宽高为 50px 的预览区域 -->
                        <div class="img-preview w50"></div>
                        <p class="size">50 x 50</p>
                    </div>
                </div>
            </div>
            <!-- <div class="layui-btn">
            <input type="file" id="file">
            <p> 选择文件</p>
        </div>
        <button class="layui-btn layui-btn-warm" id="uploadimg">上传头像</button> -->
            <!-- 第二行的按钮区域 -->
            <div class="row2">
                <input type="file" id="file" accept="image/png,image/jpeg" />
                <button type="button" id="btnChooseImage" class="layui-btn">上传</button>
                <button type="button" id="uploadimg" class="layui-btn layui-btn-danger">确定</button>
            </div>
        </div>
    </div>
    <script src="../assets/lib/layui/layui.all.js"></script>
    <script src="../assets/lib/jquery.js"></script>
    <script src="../assets/lib/cropper/Cropper.js"></script>
    <script src="../assets/lib/cropper/jquery-cropper.js"></script>
    <script src="../assets/js/setHeadPic.js"></script>
    <script src="../assets/js/users/upload.js"></script>
</body>

</html>